﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
using MFTool;

namespace AutoUI.Areas.ConfigUI.EasyUICtrl
{
    public class DateBox : CtrlBase
    {
        public DateBox(string id, EasyUICtrlPrepareData pData)
            : base(id, pData)
        {
            if (_dataOption.Count == 0)
            {
                _dataOption = DefaultValue.DateBox().JsonToDictionary();
            }
        }
        public override void Prepare()
        {
            DomStr = "input";
            _class.Add("easyui-datebox");
        }

        public override void PrepareSearchCtrl()
        {
            Prepare();
        }

        public override string GetGridScript(string fieldName, string gridId)
        {
            string dateFormat = _dataOption.GetValue("dateFormat");
            string script = "addGridDate('{0}','{1}','{2}');".ReplaceArg(gridId, fieldName, dateFormat);
            return script;
        }
    }
}